<tr id="<%= spree_dom_id(metafield_definition) %>">
  <td><code><%= metafield_definition.full_key %></code></td>
  <td><%= metafield_definition.name %></td>
  <td><%= metafield_definition.resource_type.demodulize.titleize %></td>
  <td><span class="badge badge-light"><%= metafield_definition.metafield_type.demodulize.titleize %></span></td>
  <td>
    <%= form_with model: metafield_definition, url: admin_metafield_definition_path(metafield_definition), method: :patch, data: { controller: 'auto-submit' } do |f| %>
      <%= f.select :display_on, display_on_options(Spree::MetafieldDefinition), {}, { class: 'custom-select custom-select-sm w-auto', data: { action: 'auto-submit#submit' } } %>
    <% end %>
  </td>
  <td>
    <% if metafield_definition.metafields.count.positive? %>
      <%= metafield_definition.metafields.count %>
      <%= Spree.t(metafield_definition.resource_type.demodulize.pluralize.to_sym) %>
    <% else %>
      <span class="text-muted"><%= Spree.t(:not_available) %></span>
    <% end %>
  </td>
  <td class="text-right">
    <%= link_to_edit(metafield_definition, data: { turbo_frame: '_top' }) %>
  </td>
</tr>